package com.my.plugin.tools;


/**
 * sql查询的参数封装
 * 
 * @author YH
 *
 */
public class ParamType {
	private String name;		//参数名
	private String logicType; // 逻辑运算符
	private String relaType; // 关系运算符
	private Object param; // 参数
	private String sort; // 排序方式，null的话不排序order by
	private boolean find=true;

	// 逻辑运算符
	public final static String LOGIC_TYPE_OR = "or"; // or
	public final static String LOGIC_TYPE_AND = "and"; // and

	// 关系运算符
	public final static String RELA_TYPE_EQUAL = "="; // 等于
	public final static String RELA_TYPE_NOT_EQUAL = "!="; // 不等于
	public final static String RELA_TYPE_GREATER = ">"; // 大于
	public final static String RELA_TYPE_LESS = "<"; // 小于
	public final static String RELA_TYPE_GREATER_EQUAL = ">="; // 大于等于
	public final static String RELA_TYPE_LESS_EQUAL = "<="; // 小于等于
	public final static String RELA_TYPE_LIKE = "like"; // 模糊查询

	
	
	
	// 排序方式
	public final static String SORT_DESC = "desc";	//逆序
	public final static String SORT_ASC = "asc";	//正序

	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public String getLogicType() {
		return logicType;
	}

	public void setLogicType(String logicType) {
		this.logicType = logicType;
	}

	public String getRelaType() {
		return relaType;
	}

	public void setRelaType(String relaType) {
		this.relaType = relaType;
	}

	public Object getParam() {
		return param;
	}

	public void setParam(Object param) {
		this.param = param;
	}



	/**
	 * 默认为=和and,find为true
	 * @param name
	 * @param param
	 */
	public ParamType(String name, Object param) {
		super();
		this.name = name;
		this.param = param;
		this.find=true;
		this.logicType =LOGIC_TYPE_AND;
		this.relaType = RELA_TYPE_EQUAL;
	}

	/**
	 * 只用来排序，不作为查询的条件
	 * @param name
	 * @param sort
	 */
	public ParamType(String name, String sort) {
		super();
		this.name = name;
		this.sort = sort;
		this.find=false;
	}

	/**
	 * 构造方法，有排序
	 * @param name 参数名
	 * @param logicType	逻辑运算 or and
	 * @param relaType	关系运算 + -
	 * @param param	参数
	 * @param sort	排序
	 */
	public ParamType(String name, String logicType, String relaType, Object param, String sort,boolean find) {
		super();
		this.name = name;
		this.logicType = logicType;
		this.relaType = relaType;
		this.param = param;
		this.sort = sort;
		this.find=find;
	}

	/**
	 * 构造方法，无排序
	 * @param name	参数名
	 * @param logicType 逻辑运算 or and
	 * @param relaType 关系运算 + -
	 * @param param 参数
	 */
	public ParamType(String name, String logicType, String relaType, Object param) {
		super();
		this.name = name;
		this.logicType = logicType;
		this.relaType = relaType;
		this.param = param;
	}

	



	public boolean getFind() {
		return find;
	}

	public void setFind(boolean find) {
		this.find = find;
	}

	public ParamType() {
		super();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	

}
